import {Component, Input, OnInit} from '@angular/core';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute} from '@angular/router';

@Component({
  selector: 'app-head',
  templateUrl: './head.component.html',
  styleUrls: ['./head.component.scss']
})
export class HeadComponent implements OnInit {
  public title: any = '商城'
  constructor(private titleService: Title, public router: ActivatedRoute) {
  titleService.getTitle();
  }

  ngOnInit() {
    this.router.queryParams.subscribe((result: any) => {
      console.log(result.title);
      if (!result.title ) {
        this.title = '商城';
      } else {
        this.title = result.title;
      }
    } );
  }
}
